gtk-demo: Don't leak the markup
authorMatthias Clasen <mclasen@redhat.com>
Fri, 7 Aug 2020 19:19:33 +0000 (15:19 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 7 Aug 2020 19:19:33 +0000 (15:19 -0400)
demos/gtk-demo/main.c

index 1589b3d4bc047dda87f179ad06c0a3b9f930b110..b14e3b09090c52aa8b4222630c10f9412ceee4e1 100644 (file)
@@ -319,13 +319,13 @@ fontify (const char    *format,
   bytes = fontify_text (format, text);
   if (bytes)
     {
-      const char *markup;
+      char *markup;
       gsize len;
 
-      markup = g_bytes_get_data (bytes, &len);
+      markup = g_bytes_unref_to_data (bytes, &len);
       gtk_text_buffer_delete (source_buffer, &start, &end);
       gtk_text_buffer_insert_markup (source_buffer, &start, markup, len);
-      g_bytes_unref (bytes);
+      g_free (markup);
     }
 
   g_free (text);